import time

from base.base_page import Base
from base.element_data import AddContacts

ele_all = AddContacts


class Setting(Base):
    def __init__(self, driver):
        self.driver = driver
        super().__init__(self.driver)

    def test01(self):
        self.tap(ele_all.tt_start)

    def set02(self):
        # self.swipe_run('right')
        # time.sleep(2)
        # self.swipe_run('left')
        # time.sleep(1)
        # self.swipe_run('up')
        # time.sleep(2)
        # self.swipe_run('down')
        # self.click(ele_all.account)
        self.tap(ele_all.my_study_xy)
        time.sleep(1)
        # attr = self.get_attribute(ele_all.a01, 'text')
        # self.assert_run('好奖随心选', attr)

    def set03(self):
        self.click(ele_all.my_study)
        self.click(ele_all.login)
        self.send_keys(ele_all.login_user, '18825189761')
        self.send_keys(ele_all.login_pw, '123456')

        self.click(ele_all.submit01)
        ele = self.find_toast(ele_all.msg)
        self.get_attribute(ele, 'text')
        # self.back()
        # ele = self.find_element_all(ele_all.toast_01)
        # attr = self.get_attribute(ele, 'text')
        # print(attr)4

    def set04(self):
        # try:
        #     ele = self.find_element_all(ele_all.skip)
        #     self.click(ele)
        # except:
        #     pass
        self.click(ele_all.my_study)
        self.click(ele_all.my_issue)
        self.click(ele_all.issue_01)
        time.sleep(5)
        handles = self.get_contexts()
        self.switch_to_context(handles[1])
        self.current_context()

    def set01(self):
        self.click(ele_all.tt_01)
        # except:
        #     self.click(ele_all.tt_02)
        time.sleep(5)
        handles = self.get_contexts()
        self.switch_to_context(handles[1])
        self.switch_to_context(handles[0])
        self.current_context()


if __name__ == '__main__':
    pass
    # Setting.test01()
